<?php
 class Thanhvien_phanloai_model extends CI_Model{
     public function __construct() {
         parent::__construct();
         $this->load->database();
     }
     public function load_phanloai_from_thanhvien($id){

        $this->db->select('gs7s_thanhvien_phanloai.id,gs7s_thanhvien_phanloai.ten');
        $this->db->from('gs7s_thanhvien');
        $this->db->where('gs7s_thanhvien.id',$id);
        $this->db->limit(1);
        $this->db->join('gs7s_thanhvien_phanloai', 'gs7s_thanhvien_phanloai.id=gs7s_thanhvien.phanloai_id');
        $query=$this->db->get();
        
        return $query->row();
     }
     public function load_phanloai($id) {
       
         $query = $this->db->get_where('gs7s_thanhvien_phanloai', array('id' => $id));
         return $query->row()->ten;
     }
 }

